package graph;

public class Test {
    public static void main(String[] args) {
        GraphByMatrix graph = new GraphByMatrix(4, false);
        char[] arr = {'A', 'B', 'C', 'D'};
        graph.initArrayV(arr);
        graph.addEdge('A', 'B', 1);
        graph.addEdge('A', 'D', 3);
        graph.addEdge('A', 'C', 3);
        graph.addEdge('B', 'C', 2);
        graph.addEdge('D', 'C', 4);

        graph.printGraph();
        graph.dfs('A');
    }
    public static void main2(String[] args) {
        GraphByNode graph = new GraphByNode(4,false);
        char[] arr = {'A','B','C','D'};
        graph.initArrayV(arr);
        graph.addEdge('A','B',1);
        graph.addEdge('A','C',3);
        graph.addEdge('B','C',2);
        graph.addEdge('D','C',4);

        graph.printGraph();
        System.out.println(graph.getDegreeOfV('D'));
        System.out.println(graph.getDegreeOfV('A'));
        System.out.println(graph.getDegreeOfV('B'));
        System.out.println(graph.getDegreeOfV('C'));
    }
    public static void main1(String[] args) {
        GraphByMatrix graph = new GraphByMatrix(4,true);
        char[] arr = {'A','B','C','D'};
        graph.initArrayV(arr);
        graph.addEdge('A','B',1);
        graph.addEdge('A','C',3);
        graph.addEdge('B','C',2);
        graph.addEdge('D','C',4);
        graph.addEdge('B','A',1);
        graph.addEdge('D','A',9);
        graph.addEdge('D','B',5);


        graph.printGraph();

        System.out.println(graph.getDegreeOfV('D'));
        System.out.println(graph.getDegreeOfV('A'));
        System.out.println(graph.getDegreeOfV('B'));
        System.out.println(graph.getDegreeOfV('C'));
    }
}
